<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="path" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html>
<html>
<title>登陆 | spinach</title>
<jsp:include page="common/head.jsp"></jsp:include>
<link rel="stylesheet" type="text/css"
	href="${path}/static/css/login.css" />
<body>
	<div class="container">

		<form class="form-signin login-form" action="${path}/login.json" id="fm"
			method="post">
			<h2 class="form-signin-heading">登录系统</h2>
			<div class="alert alert-error hide">
				<span>请输入用户名或密码.</span>
			</div>
			<div>
				<input type="text" name="username" class="input-block-level"
					placeholder="账号" value="demo" datatype="*" nullmsg="请输入用户名！" /> <span
					class="Validform_checktip"></span>
			</div>
			<div>

				<input type="password" name="password" class="input-block-level"
					placeholder="密码" value="123456" datatype="*" nullmsg="密码不能为空！" />
				<span class="Validform_checktip"></span>
			</div>
			<div>
			<input type="text" class="input-block-level" style="width: 200px;" name="captcha" placeholder="请输入验证码！"  datatype="*" nullmsg="请输入验证码！">
			 <img id="captchaImg" src="${path}/getCaptcha" width="50px" height="20px"
	                 style="border: 1px solid #898989; width: 60px; height: 30px; margin-bottom:15px; vertical-align: middle;cursor:pointer;"/>
			<span class="Validform_checktip"></span>
			</div>
	        <div >
	           
	        </div>

			<p>
				<button class="btn btn-large btn-primary" type="submit">登录</button>
			</p>
		</form>
	</div>
	<jsp:include page="common/foot.jsp"></jsp:include>
	<script type="text/javascript">
	$("#captchaImg").click(function () {
        $(this).attr("src", "${path}/getCaptcha?date=" + new Date());
    });
		var callback = function(data) {
			if (data.status == "0") {
				window.location.href = "${path}/index";
			} else {
				$('.alert-error', $('.login-form')).find("span").html(data.msg);
				$('.alert-error', $('.login-form')).show();
			}
		}
		$("#fm").validFrom(callback);
	</script>
</body>
</html>